package com.web.controller;


import com.bean.News;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class RestController {
    //post:http://localhost:8080/news       Restful
    //     http://localhost:8080/news/add   SSH/SSM
    //     http://localhost:8080/addNews    Servlet
    @RequestMapping(value = "/news",method = RequestMethod.POST)
    public String add(){
        return "list";
    }
    /*
    * 修改的步骤
    * 1、
    * */
    @RequestMapping(value = "/news/{id}",method = RequestMethod.GET)
    public String get(@PathVariable("id")int id){
        //查询新闻对象
        return "ok";//返回修改页面
    }
    @RequestMapping(value = "/news",method = RequestMethod.GET)
    public String find(int id){
        return  "list";
    }
    @RequestMapping(value = "/news",method = RequestMethod.PUT)
    public String edit(News news){
        return "list";
    }
    @RequestMapping(value = "/news",method = RequestMethod.DELETE)
    public String delete(int id){
        return "list";
    }

}
